package cn.HuanG.org.service.impl;

import cn.HuanG.org.domain.OtherLogEntity;
import cn.HuanG.org.mapper.OtherLogMapper;
import cn.HuanG.org.query.OtherLogQuery;
import cn.HuanG.org.service.IOtherLogService;
import cn.HuanG.util.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Propagation;
import org.springframework.transaction.annotation.Transactional;

import java.util.List;

@Service
@Transactional(readOnly = true, propagation = Propagation.SUPPORTS)
public class OtherLogServiceImpl implements IOtherLogService {
    @Autowired
    private OtherLogMapper otherLogMapper;
    @Override
    public List<OtherLogEntity> queryAll() {
        return otherLogMapper.queryAll();
    }

    @Override
    public OtherLogEntity queryById(Long id) {
        return otherLogMapper.queryById(id);
    }
    @Transactional
    @Override
    public void save(OtherLogEntity OtherLogEntity) {
        otherLogMapper.save(OtherLogEntity);
    }
    @Transactional
    @Override
    public void update(OtherLogEntity OtherLogEntity) {
        otherLogMapper.update(OtherLogEntity);
    }
    @Transactional
    @Override
    public void delete(Long id) {
        otherLogMapper.delete(id);
    }
    @Transactional
    @Override
    public void patchDelete(Long[] ids) {
        otherLogMapper.patchDelete(ids);
    }

    @Override
    //@OtherLog(logName = "分页查询")
    public PageInfo<OtherLogEntity> queryPage(OtherLogQuery query) {
        // 总条数查询
        Long conut = otherLogMapper.count(query);
        // 分页数据查询
        List<OtherLogEntity> list = otherLogMapper.queryDate(query);
        return new PageInfo<>(conut,list);
    }
}
